<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生信息管理页面</title>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <style>
        table, td, th{border:1px solid green;background-color: lemonchiffon;text-align:center}
    </style>
</head>
<body>
<form action="/web/user/insert.do" method="post">
    <table>
        <tr>
            <td><label>ID</label></td>
            <td><input name="id" type="text"></td>
        </tr>
        <tr>
            <td><label>code</label></td>
            <td><input name="code" type="text"></td>
        </tr>
        <tr>
            <td><label>name</label></td>
            <td><input name="name" type="text"></td>
        </tr>
        <tr>
            <td><label>sex</label></td>
            <td><input name="sex" type="text"></td>
        </tr>
        <tr>
            <td><label>price</label></td>
            <td><input name="price" type="text"></td>
        </tr>
        <tr>
            <td><label>type</label></td>
            <td><input name="type" type="text"></td>
        </tr>
        <tr>
            <td><label>attention</label></td>
            <td><input name="attention" type="text"></td>
        </tr>
        <tr>
            <td><label>remark</label></td>
            <td><input name="remark" type="text"></td>
        </tr>
        <tr>
            <td><input id="sub" type="button" value="get"/></td>
        </tr>
    </table>
</form>
</body>
<script>
    $(function () {
        $("#sub").onclick = function () {
            $.ajax({
                type:"POST",
                url:"/web/user/insert",
                data:JSON.stringify({
                    id:$('input[name="id"]').val(),
                    code:$('input[name="code"]').val(),
                    name:$('input[name="name"]').val(),
                    sex:$('input[name="sex"]').val(),
                    age:$('input[name="age"]').val(),
                    price:$('input[name="price"]').val(),
                    type:$('input[name="type"]').val(),
                    attention:$('input[name="attention"]').val(),
                    remark:$('input[name="remark"]').val(),
                }),
                contentType:'application/json;charset=utf-8',
                dataType:'json',
                success:function (jsonResult) {
                    console.log(jsonResult);
                    $("#errorString").html(jsonResult.message);
                }
            })
        }
    })
</script>
</html>
